// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A notification object for notifying customers about security and privacy
/// issues.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Notification {
    /// The resource name of the notification.
    /// Format:
    /// organizations/{organization}/locations/{location}/notifications/{notification}
    /// or projects/{project}/locations/{location}/notifications/{notification}.
    pub name: std::string::String,

    /// The subject line of the notification.
    pub subject: std::option::Option<crate::model::Subject>,

    /// A list of messages in the notification.
    pub messages: std::vec::Vec<crate::model::Message>,

    /// Output only. Time the notification was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Type of notification
    pub notification_type: crate::model::NotificationType,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Notification {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Notification::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [subject][crate::model::Notification::subject].
    pub fn set_subject<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Subject>,
    {
        self.subject = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [subject][crate::model::Notification::subject].
    pub fn set_or_clear_subject<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Subject>,
    {
        self.subject = v.map(|x| x.into());
        self
    }

    /// Sets the value of [messages][crate::model::Notification::messages].
    pub fn set_messages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Message>,
    {
        use std::iter::Iterator;
        self.messages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [create_time][crate::model::Notification::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Notification::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [notification_type][crate::model::Notification::notification_type].
    pub fn set_notification_type<T: std::convert::Into<crate::model::NotificationType>>(
        mut self,
        v: T,
    ) -> Self {
        self.notification_type = v.into();
        self
    }
}

impl wkt::message::Message for Notification {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Notification"
    }
}

/// A text object containing the English text and its localized copies.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Text {
    /// The English copy.
    pub en_text: std::string::String,

    /// The requested localized copy (if applicable).
    pub localized_text: std::string::String,

    /// Status of the localization.
    pub localization_state: crate::model::LocalizationState,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Text {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [en_text][crate::model::Text::en_text].
    pub fn set_en_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.en_text = v.into();
        self
    }

    /// Sets the value of [localized_text][crate::model::Text::localized_text].
    pub fn set_localized_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.localized_text = v.into();
        self
    }

    /// Sets the value of [localization_state][crate::model::Text::localization_state].
    pub fn set_localization_state<T: std::convert::Into<crate::model::LocalizationState>>(
        mut self,
        v: T,
    ) -> Self {
        self.localization_state = v.into();
        self
    }
}

impl wkt::message::Message for Text {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Text"
    }
}

/// A subject line of a notification.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Subject {
    /// The text content.
    pub text: std::option::Option<crate::model::Text>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Subject {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [text][crate::model::Subject::text].
    pub fn set_text<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Text>,
    {
        self.text = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [text][crate::model::Subject::text].
    pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Text>,
    {
        self.text = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Subject {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Subject"
    }
}

/// A message which contains notification details.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Message {
    /// The message content.
    pub body: std::option::Option<crate::model::message::Body>,

    /// The attachments to download.
    pub attachments: std::vec::Vec<crate::model::Attachment>,

    /// The Message creation timestamp.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Time when Message was localized
    pub localization_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Message {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [body][crate::model::Message::body].
    pub fn set_body<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::message::Body>,
    {
        self.body = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [body][crate::model::Message::body].
    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::message::Body>,
    {
        self.body = v.map(|x| x.into());
        self
    }

    /// Sets the value of [attachments][crate::model::Message::attachments].
    pub fn set_attachments<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Attachment>,
    {
        use std::iter::Iterator;
        self.attachments = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [create_time][crate::model::Message::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Message::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [localization_time][crate::model::Message::localization_time].
    pub fn set_localization_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.localization_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [localization_time][crate::model::Message::localization_time].
    pub fn set_or_clear_localization_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.localization_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Message {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Message"
    }
}

/// Defines additional types related to [Message].
pub mod message {
    #[allow(unused_imports)]
    use super::*;

    /// A message body containing text.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Body {
        /// The text content of the message body.
        pub text: std::option::Option<crate::model::Text>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Body {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [text][crate::model::message::Body::text].
        pub fn set_text<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Text>,
        {
            self.text = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [text][crate::model::message::Body::text].
        pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Text>,
        {
            self.text = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Body {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.advisorynotifications.v1.Message.Body"
        }
    }
}

/// Attachment with specific information about the issue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Attachment {
    /// The title of the attachment.
    pub display_name: std::string::String,

    /// Data type of the attachment.
    pub data: std::option::Option<crate::model::attachment::Data>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Attachment {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::Attachment::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [data][crate::model::Attachment::data].
    ///
    /// Note that all the setters affecting `data` are mutually
    /// exclusive.
    pub fn set_data<T: std::convert::Into<std::option::Option<crate::model::attachment::Data>>>(
        mut self,
        v: T,
    ) -> Self {
        self.data = v.into();
        self
    }

    /// The value of [data][crate::model::Attachment::data]
    /// if it holds a `Csv`, `None` if the field is not set or
    /// holds a different branch.
    pub fn csv(&self) -> std::option::Option<&std::boxed::Box<crate::model::Csv>> {
        #[allow(unreachable_patterns)]
        self.data.as_ref().and_then(|v| match v {
            crate::model::attachment::Data::Csv(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [data][crate::model::Attachment::data]
    /// to hold a `Csv`.
    ///
    /// Note that all the setters affecting `data` are
    /// mutually exclusive.
    pub fn set_csv<T: std::convert::Into<std::boxed::Box<crate::model::Csv>>>(
        mut self,
        v: T,
    ) -> Self {
        self.data = std::option::Option::Some(crate::model::attachment::Data::Csv(v.into()));
        self
    }
}

impl wkt::message::Message for Attachment {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Attachment"
    }
}

/// Defines additional types related to [Attachment].
pub mod attachment {
    #[allow(unused_imports)]
    use super::*;

    /// Data type of the attachment.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Data {
        /// A CSV file attachment. Max size is 10 MB.
        Csv(std::boxed::Box<crate::model::Csv>),
    }
}

/// A representation of a CSV file attachment, as a list of column headers and
/// a list of data rows.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Csv {
    /// The list of headers for data columns in a CSV file.
    pub headers: std::vec::Vec<std::string::String>,

    /// The list of data rows in a CSV file, as string arrays rather than as a
    /// single comma-separated string.
    pub data_rows: std::vec::Vec<crate::model::csv::CsvRow>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Csv {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [headers][crate::model::Csv::headers].
    pub fn set_headers<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.headers = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [data_rows][crate::model::Csv::data_rows].
    pub fn set_data_rows<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::csv::CsvRow>,
    {
        use std::iter::Iterator;
        self.data_rows = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Csv {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Csv"
    }
}

/// Defines additional types related to [Csv].
pub mod csv {
    #[allow(unused_imports)]
    use super::*;

    /// A representation of a single data row in a CSV file.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CsvRow {
        /// The data entries in a CSV file row, as a string array rather than a
        /// single comma-separated string.
        pub entries: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CsvRow {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [entries][crate::model::csv::CsvRow::entries].
        pub fn set_entries<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.entries = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for CsvRow {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.advisorynotifications.v1.Csv.CsvRow"
        }
    }
}

/// Request for fetching all notifications for a given parent.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotificationsRequest {
    /// Required. The parent, which owns this collection of notifications.
    /// Must be of the form "organizations/{organization}/locations/{location}"
    /// or "projects/{project}/locations/{location}".
    pub parent: std::string::String,

    /// The maximum number of notifications to return. The service may return
    /// fewer than this value. If unspecified or equal to 0, at most 50
    /// notifications will be returned. The maximum value is 50; values above 50
    /// will be coerced to 50.
    pub page_size: i32,

    /// A page token returned from a previous request.
    /// When paginating, all other parameters provided in the request
    /// must match the call that returned the page token.
    pub page_token: std::string::String,

    /// Specifies which parts of the notification resource should be returned
    /// in the response.
    pub view: crate::model::NotificationView,

    /// ISO code for requested localization language.  If unset, will be
    /// interpereted as "en". If the requested language is valid, but not supported
    /// for this notification, English will be returned with an "Not applicable"
    /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
    /// this RPC will throw an error.
    pub language_code: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListNotificationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListNotificationsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListNotificationsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListNotificationsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [view][crate::model::ListNotificationsRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::NotificationView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }

    /// Sets the value of [language_code][crate::model::ListNotificationsRequest::language_code].
    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.language_code = v.into();
        self
    }
}

impl wkt::message::Message for ListNotificationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsRequest"
    }
}

/// Response of ListNotifications endpoint.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotificationsResponse {
    /// List of notifications under a given parent.
    pub notifications: std::vec::Vec<crate::model::Notification>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    /// Estimation of a total number of notifications.
    pub total_size: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListNotificationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [notifications][crate::model::ListNotificationsResponse::notifications].
    pub fn set_notifications<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Notification>,
    {
        use std::iter::Iterator;
        self.notifications = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListNotificationsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [total_size][crate::model::ListNotificationsResponse::total_size].
    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.total_size = v.into();
        self
    }
}

impl wkt::message::Message for ListNotificationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListNotificationsResponse {
    type PageItem = crate::model::Notification;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.notifications
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request for fetching a notification.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetNotificationRequest {
    /// Required. A name of the notification to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/notifications/{notification}
    /// or projects/{projects}/locations/{location}/notifications/{notification}.
    pub name: std::string::String,

    /// ISO code for requested localization language. If unset, will be
    /// interpereted as "en". If the requested language is valid, but not supported
    /// for this notification, English will be returned with an "Not applicable"
    /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
    /// this RPC will throw an error.
    pub language_code: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetNotificationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetNotificationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [language_code][crate::model::GetNotificationRequest::language_code].
    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.language_code = v.into();
        self
    }
}

impl wkt::message::Message for GetNotificationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.GetNotificationRequest"
    }
}

/// Settings for Advisory Notifications.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Settings {
    /// Identifier. The resource name of the settings to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/settings or
    /// projects/{projects}/locations/{location}/settings.
    pub name: std::string::String,

    /// Required. Map of each notification type and its settings to get/set all
    /// settings at once. The server will validate the value for each notification
    /// type.
    pub notification_settings:
        std::collections::HashMap<std::string::String, crate::model::NotificationSettings>,

    /// Required. Fingerprint for optimistic concurrency returned in Get requests.
    /// Must be provided for Update requests. If the value provided does not match
    /// the value known to the server, ABORTED will be thrown, and the client
    /// should retry the read-modify-write cycle.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Settings {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Settings::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [notification_settings][crate::model::Settings::notification_settings].
    pub fn set_notification_settings<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::NotificationSettings>,
    {
        use std::iter::Iterator;
        self.notification_settings = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [etag][crate::model::Settings::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for Settings {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.Settings"
    }
}

/// Settings for each NotificationType.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NotificationSettings {
    /// Whether the associated NotificationType is enabled.
    pub enabled: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl NotificationSettings {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [enabled][crate::model::NotificationSettings::enabled].
    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enabled = v.into();
        self
    }
}

impl wkt::message::Message for NotificationSettings {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.NotificationSettings"
    }
}

/// Request of GetSettings endpoint.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSettingsRequest {
    /// Required. The resource name of the settings to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/settings or
    /// projects/{projects}/locations/{location}/settings.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetSettingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetSettingsRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetSettingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.GetSettingsRequest"
    }
}

/// Request of UpdateSettings endpoint.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSettingsRequest {
    /// Required. New settings.
    pub settings: std::option::Option<crate::model::Settings>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateSettingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [settings][crate::model::UpdateSettingsRequest::settings].
    pub fn set_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Settings>,
    {
        self.settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [settings][crate::model::UpdateSettingsRequest::settings].
    pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Settings>,
    {
        self.settings = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateSettingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.advisorynotifications.v1.UpdateSettingsRequest"
    }
}

/// Notification view.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NotificationView {
    /// Not specified, equivalent to BASIC.
    Unspecified,
    /// Server responses only include title, creation time and Notification ID.
    /// Note: for internal use responses also include the last update time,
    /// the latest message text and whether notification has attachments.
    Basic,
    /// Include everything.
    Full,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [NotificationView::value] or
    /// [NotificationView::name].
    UnknownValue(notification_view::UnknownValue),
}

#[doc(hidden)]
pub mod notification_view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl NotificationView {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Basic => std::option::Option::Some(1),
            Self::Full => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("NOTIFICATION_VIEW_UNSPECIFIED"),
            Self::Basic => std::option::Option::Some("BASIC"),
            Self::Full => std::option::Option::Some("FULL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for NotificationView {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for NotificationView {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for NotificationView {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Basic,
            2 => Self::Full,
            _ => Self::UnknownValue(notification_view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for NotificationView {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "NOTIFICATION_VIEW_UNSPECIFIED" => Self::Unspecified,
            "BASIC" => Self::Basic,
            "FULL" => Self::Full,
            _ => Self::UnknownValue(notification_view::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for NotificationView {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Basic => serializer.serialize_i32(1),
            Self::Full => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for NotificationView {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationView>::new(
            ".google.cloud.advisorynotifications.v1.NotificationView",
        ))
    }
}

/// Status of localized text.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LocalizationState {
    /// Not used.
    Unspecified,
    /// Localization is not applicable for requested language. This can happen
    /// when:
    ///
    /// - The requested language was not supported by Advisory Notifications at the
    ///   time of localization (including notifications created before the
    ///   localization feature was launched).
    /// - The requested language is English, so only the English text is returned.
    NotApplicable,
    /// Localization for requested language is in progress, and not ready yet.
    Pending,
    /// Localization for requested language is completed.
    Completed,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [LocalizationState::value] or
    /// [LocalizationState::name].
    UnknownValue(localization_state::UnknownValue),
}

#[doc(hidden)]
pub mod localization_state {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl LocalizationState {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::NotApplicable => std::option::Option::Some(1),
            Self::Pending => std::option::Option::Some(2),
            Self::Completed => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("LOCALIZATION_STATE_UNSPECIFIED"),
            Self::NotApplicable => std::option::Option::Some("LOCALIZATION_STATE_NOT_APPLICABLE"),
            Self::Pending => std::option::Option::Some("LOCALIZATION_STATE_PENDING"),
            Self::Completed => std::option::Option::Some("LOCALIZATION_STATE_COMPLETED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for LocalizationState {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for LocalizationState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for LocalizationState {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::NotApplicable,
            2 => Self::Pending,
            3 => Self::Completed,
            _ => Self::UnknownValue(localization_state::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for LocalizationState {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "LOCALIZATION_STATE_UNSPECIFIED" => Self::Unspecified,
            "LOCALIZATION_STATE_NOT_APPLICABLE" => Self::NotApplicable,
            "LOCALIZATION_STATE_PENDING" => Self::Pending,
            "LOCALIZATION_STATE_COMPLETED" => Self::Completed,
            _ => Self::UnknownValue(localization_state::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for LocalizationState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::NotApplicable => serializer.serialize_i32(1),
            Self::Pending => serializer.serialize_i32(2),
            Self::Completed => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for LocalizationState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LocalizationState>::new(
            ".google.cloud.advisorynotifications.v1.LocalizationState",
        ))
    }
}

/// Type of notification
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NotificationType {
    /// Default type
    Unspecified,
    /// Security and privacy advisory notifications
    SecurityPrivacyAdvisory,
    /// Sensitive action notifications
    SensitiveActions,
    /// General security MSA
    SecurityMsa,
    /// Threat horizons MSA
    ThreatHorizons,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [NotificationType::value] or
    /// [NotificationType::name].
    UnknownValue(notification_type::UnknownValue),
}

#[doc(hidden)]
pub mod notification_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl NotificationType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::SecurityPrivacyAdvisory => std::option::Option::Some(1),
            Self::SensitiveActions => std::option::Option::Some(2),
            Self::SecurityMsa => std::option::Option::Some(3),
            Self::ThreatHorizons => std::option::Option::Some(4),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("NOTIFICATION_TYPE_UNSPECIFIED"),
            Self::SecurityPrivacyAdvisory => {
                std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY")
            }
            Self::SensitiveActions => {
                std::option::Option::Some("NOTIFICATION_TYPE_SENSITIVE_ACTIONS")
            }
            Self::SecurityMsa => std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_MSA"),
            Self::ThreatHorizons => std::option::Option::Some("NOTIFICATION_TYPE_THREAT_HORIZONS"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for NotificationType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for NotificationType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for NotificationType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::SecurityPrivacyAdvisory,
            2 => Self::SensitiveActions,
            3 => Self::SecurityMsa,
            4 => Self::ThreatHorizons,
            _ => Self::UnknownValue(notification_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for NotificationType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "NOTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
            "NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY" => Self::SecurityPrivacyAdvisory,
            "NOTIFICATION_TYPE_SENSITIVE_ACTIONS" => Self::SensitiveActions,
            "NOTIFICATION_TYPE_SECURITY_MSA" => Self::SecurityMsa,
            "NOTIFICATION_TYPE_THREAT_HORIZONS" => Self::ThreatHorizons,
            _ => Self::UnknownValue(notification_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for NotificationType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::SecurityPrivacyAdvisory => serializer.serialize_i32(1),
            Self::SensitiveActions => serializer.serialize_i32(2),
            Self::SecurityMsa => serializer.serialize_i32(3),
            Self::ThreatHorizons => serializer.serialize_i32(4),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for NotificationType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationType>::new(
            ".google.cloud.advisorynotifications.v1.NotificationType",
        ))
    }
}
